-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unstructured output #606
unstructured output #606
Conversation
The pull request seems to be introducing the concept of a "json_schema" response type. The "json_schema" response type is being handled alongside the existing "json_object" type in various parts of the codebase. The changes allow for a stricter JSON Schema that requires all fields. This PR also includes some refactoring and formatting changes (like using destructuring for import statements and reformatting long lines of code) for better code readability. Test cases have been added to verify the new strict schema functionality, which is good for maintaining code quality. From the diff, all changes seem to be implemented correctly and adequately and no functional issues are apparent. LGTM 🚀
|
|
||
You can specify a `responseSchema` in the script metadata which will automatically turn on the JSON mode. The output will be validated against the schema, and GenAIScript will attempt to repair the output is not valid. The script will fail if the output does not match the schema. | ||
You can specify a [schema](/genaiscript/reference/scripts/schemas) through `responseSchema` which will automatically turn on the JSON mode. The output will be validated against the schema, and GenAIScript will attempt to repair the output is not valid. The script will fail if the output does not match the schema. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase "attempt to repair the output is not valid" should be corrected to "attempt to repair if the output is not valid".
generated by pr-docs-review-commit
grammar
Note that there are [several restrictions](https://platform.openai.com/docs/guides/structured-outputs/how-to-use) on the schema features supported by this mode. | ||
|
||
- `additionalProperties: true` is not supported. | ||
- all optional fields (e.g. not in `required`) will be returned and might be `null` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last line is missing a newline character at the end of the file.
generated by pr-docs-review-commit
missing_info
responseType
tojson_schema
.openai
andpromptfoo
dependencies inpackage.json
of bothcli
andcore
package.chat.ts
andexpander.ts
to manage new scenarios of output formatting via JSON schema.json_schema
to theresponseType
enum inprompt_template.d.ts
for the frontend.genai.mjs
scripts to the sample package.